package com.hp.controller;

import com.hp.pojo.Renting;
import com.hp.pojo.Sell;
import com.hp.service.SellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController

public class SellController {
    @Autowired private SellService sellService;

    @PostMapping("/getAllSells")
    Map<String,Object> getAllSells (){
        return sellService.getAllSells();
    }

    @PostMapping("/getSellsAll")
    Map<String,Object> getSellsAll(){
        return sellService.getSellsAll();
    }

    @PostMapping("/getAllSellsByHouseId")
    Map<String,Object> getAllSellsByHouseId (int houseId){
        /*
        获取所有rentings
         */
        return sellService.getAllSellsByHouseId(houseId);
    }
    @PostMapping("/changeRenting_apply")
    Map<String,String> getAllSells (int sellId){
        //修改某卖房记录的申请状态
        return sellService.changeApply(sellId);
    }

    @PostMapping("/addSell")
    Map<String,String> addSell (Sell sell){
        //增加 一个renting
        return sellService.addSell(sell);
    }

    @PostMapping("/getRecommandHouse_sell")
    Map<String,Object> getRecommandHouse_sell (int userId){
        //推荐系统
        return sellService.getRecommandHouse_sell(userId);
    }

    @PostMapping("/getAgentSell")
    Map<String,Object> getAgentSell (){
        return sellService.getAgentSell();
    }
}
